import datasource
import json
import threading
import time
from flask import Flask, request, jsonify
#from m import mystage,curMatchIndex, curStageID, curMatchID, curUUID, matchuuidlist, singleMatchDatas, RefreshStages
import m

app = Flask(__name__)
matchmap = {}

DEBUG = False

def runapp():
    global app
    app.run(host='0.0.0.0', port=40400)

@app.route('/HeroSelect')
def HttpHeroSelectTeam():
    if m.isSingle:
        ee = CapHeroSelectSingle()
    else:
        ee = CapHeroSelectTeam()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409
    
@app.route('/BornPosition')
def HttpBornPosition():
    ee = CapBornPos()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409
    
@app.route('/SingleScore')
def HttpSingleScore():
    ee = CapSingleScore()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409  
    
@app.route('/TotalScore')
def HttpTotalScore():
    ee = CapTotalScore()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409     
    
@app.route('/MatchEndData')
def HttpMatchEndData():
    ee = CapMatchEndData()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409    
    
@app.route('/Top10')
def HttpTop10():
    ee = CapTop10()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409  
    
@app.route('/AvgScore')
def HttpAvgScore():
    ee = CapAvgScore()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409   
    
@app.route('/AllMatchScore')
def HttpAllMatchScore():
    ee = CapAllMatchScore()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409   
    
@app.route('/RealtimeLive')
def HttpRealtimeLive():
    ee = CapRealtimeLive()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409  
    
@app.route('/Mvp')
def HttpMvp():
    ee = CapMvp()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409  
    
@app.route('/Event')
def HttpEvent():
    ee = CapRealtimeEvent()
    if ee is not None:
        #return res, 200
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409     
    
@app.route('/SetMatch')
def SetMatch():
    # 获取 GET 请求中的参数
    param1 = request.args.get('Number', 1)  # 获取名为 'param1' 的参数
    m.SetCurMatch(int(param1))
    return f"Received param1: {param1}"

@app.route('/GetMatch')
def GetMatch():
    ee = m.GetMatch()
    if ee is not None:
        return ee, 200
    else:
        return jsonify({'error': '？'}), 409  

# 英雄选择3排，计算
def CapHeroSelectTeam():
    global DEBUG
    posdata = datasource.GetPosAndHero(m.curStageID)
    teamlist = []  #队伍列表
    if posdata ==None:
        retjson = {"data":[]}
        jsonstr = json.dumps(retjson, ensure_ascii=False, indent=4)
        return jsonstr
    if posdata != None:
        #matchround = posdata["data"]["match_round"]
        mymap = posdata["data"]["map"]
        if "team" in posdata["data"] and isinstance(posdata["data"]["team"],list):
            if len(posdata["data"]["team"]) > 0:
                for iteam in posdata["data"]["team"]:
                    player1=["-",0,"-","-"]
                    player2=["-",0,"-","-"]
                    player3=["-",0,"-","-"]
                    if len(iteam["role_info"]) >= 1:
                        player1 = [iteam["role_info"][0]["role_name"],iteam["role_info"][0]["hero_id"],iteam["role_info"][0]["skills"][0]["skill_name"],iteam["role_info"][0]["skills"][1]["skill_name"]]
                    if len(iteam["role_info"]) >= 2:
                        player2 = [iteam["role_info"][1]["role_name"],iteam["role_info"][1]["hero_id"],iteam["role_info"][1]["skills"][0]["skill_name"],iteam["role_info"][1]["skills"][1]["skill_name"]]
                    if len(iteam["role_info"]) >= 3:
                        player3 = [iteam["role_info"][2]["role_name"],iteam["role_info"][2]["hero_id"],iteam["role_info"][2]["skills"][0]["skill_name"],iteam["role_info"][2]["skills"][1]["skill_name"]]
                    tmpteam = {
                        "team_name":iteam["team_name"],
                        "players":[
                            {
                                "player_name": player1[0],
                                "hero_id": m.convertList.get(str(player1[1]),"-"),
                                "skillF":player1[2],
                                "skillV":player1[3],
                                "mid":player1[1]
                            },
                            {
                                "player_name": player2[0],
                                "hero_id": m.convertList.get(str(player2[1]),"-"),
                                "skillF":player2[2],
                                "skillV":player2[3],
                                "mid":player2[1]
                            },
                            {
                                "player_name": player3[0],
                                "hero_id": m.convertList.get(str(player3[1]),"-"),
                                "skillF":player3[2],
                                "skillV":player3[3],
                                "mid":player3[1]
                            }
                        ],
                        "pick_rate":"-",
                        "average_score":"-",
                        "last_score":"-"
                    }
                    teamlist.append(tmpteam)  #添加进来
    #好，选手填完了，接下来去填充选择率和积分的数据
    lineupdata = datasource.GetHeroLineup(m.curUUID,m.curStageID)
    if lineupdata!=None:
        if lineupdata["data"]!=None and len(lineupdata["data"]) > 0:
            for itemmy in teamlist:
                for index, itemhe in enumerate(lineupdata["data"]):
                    if itemhe["team_name"] == itemmy["team_name"]:
                        myheros = [itemmy["players"][0]["mid"],itemmy["players"][1]["mid"],itemmy["players"][2]["mid"]]
                        myheross = sorted(myheros)
                        if myheross == itemhe["hero_id"]:
                            itemmy["pick_rate"] = itemhe["pick_rate"]
                            itemmy["average_score"] = itemhe["average_score"]
    #好，接下来是上局积分，不好填了呀这个
    if m.curMatchIndex > 0:  #不是第一场
        #第一局，就不用去查上局积分了，只有不是第一局的时候才去查
        for itemmy in teamlist:
            if m.singleMatchDatas[m.curMatchIndex-1] != []:
                for index, itemhe in enumerate(m.singleMatchDatas[m.curMatchIndex-1]):
                    if itemhe["team_name"] == itemmy["team_name"]:
                        itemmy["last_score"] = itemhe["score"]
    #好，填充完了终于是，转成json字符串返回回去吧
    retjson = {"data":teamlist,"map":mymap}
    jsonstr = json.dumps(retjson, ensure_ascii=False, indent=4)
    if DEBUG:
        print("我算完的是:\n"+jsonstr)
    return jsonstr

# 英雄选择单排，计算
def CapHeroSelectSingle():
    jsonstr ="""
{
"data": [
{
"team_name": "河南大学",
"players": [
{
"player_name": "河南大学.Rose",
"hero_id": "宁红夜",
"skillF": "昆仑诀·禁疗",
"skillV": "赤练无明·无拘",
"mid": 1000003
},
{
"player_name": "河南大学.天",
"hero_id": "无尘",
"skillF": "两仪剑",
"skillV": "斗转星移",
"mid": 1000013
},
{
"player_name": "河南大学.萧宝",
"hero_id": "玉玲珑",
"skillF": "尾袭",
"skillV": "迷魂引",
"mid": 1000022
}
],
"pick_rate": 0.33,
"average_score": 14.8,
"last_score": 14.5
},
{
"team_name": "辽宁广告职院",
"players": [
{
"player_name": "辽广.小染神",
"hero_id": "宁红夜",
"skillF": "昆仑诀·禁疗",
"skillV": "赤练无明",
"mid": 1000003
},
{
"player_name": "辽广.小金",
"hero_id": "无尘",
"skillF": "两仪剑",
"skillV": "斗转星移",
"mid": 1000013
},
{
"player_name": "辽广.96",
"hero_id": "玉玲珑",
"skillF": "尾袭",
"skillV": "迷魂引",
"mid": 1000022
}
],
"pick_rate": 0.33,
"average_score": 6.3,
"last_score": 9.8
},
{
"team_name": "浙江交通职院",
"players": [
{
"player_name": "浙江交通.小牛",
"hero_id": "宁红夜",
"skillF": "昆仑诀·禁疗",
"skillV": "赤练无明·无拘",
"mid": 1000003
},
{
"player_name": "浙江交通.花花",
"hero_id": "无尘",
"skillF": "两仪剑",
"skillV": "斗转星移",
"mid": 1000013
},
{
"player_name": "浙江交通.小洛",
"hero_id": "玉玲珑",
"skillF": "尾袭",
"skillV": "迷魂引",
"mid": 1000022
}
],
"pick_rate": 0.5,
"average_score": 20.6,
"last_score": 3.5
},
{
"team_name": "湖南财政学院",
"players": [
{
"player_name": "湖财大.Raki",
"hero_id": "迦南",
"skillF": "追魂·突刺",
"skillV": "寂静暗刑",
"mid": 1000004
},
{
"player_name": "湖财大.玉龙",
"hero_id": "殷紫萍",
"skillF": "益气安魂",
"skillV": "悬瓠济世",
"mid": 1000017
},
{
"player_name": "湖财大.小炫",
"hero_id": "季莹莹",
"skillF": "幽冥火·突焰",
"skillV": "无常锁·拘",
"mid": 1000021
}
],
"pick_rate": 0.33,
"average_score": 8.8,
"last_score": 34.8
},
{
"team_name": "西安体育学院",
"players": [
{
"player_name": "西体.不眠",
"hero_id": "宁红夜",
"skillF": "昆仑诀·禁疗",
"skillV": "赤练无明",
"mid": 1000003
},
{
"player_name": "西体.Reze",
"hero_id": "无尘",
"skillF": "两仪剑",
"skillV": "斗转星移",
"mid": 1000013
},
{
"player_name": "西体.北北",
"hero_id": "玉玲珑",
"skillF": "尾袭",
"skillV": "迷魂引",
"mid": 1000022
}
],
"pick_rate": 0.2,
"average_score": 17.1,
"last_score": 26.300000000000004
},
{
"team_name": "南京邮电大学",
"players": [
{
"player_name": "南邮.咖飞",
"hero_id": "胡桃",
"skillF": "庇护·守护",
"skillV": "净天地·固甲",
"mid": 1000001
},
{
"player_name": "南邮.再等",
"hero_id": "迦南",
"skillF": "追魂·突刺",
"skillV": "寂静暗刑",
"mid": 1000004
},
{
"player_name": "南邮.啵啵鱼",
"hero_id": "季莹莹",
"skillF": "幽冥火·突焰",
"skillV": "无常锁·拘",
"mid": 1000021
}
],
"pick_rate": 0.33,
"average_score": 4.8,
"last_score": 1.0
},
{
"team_name": "湖南软件大学",
"players": [
{
"player_name": "湖南软件.子芊",
"hero_id": "胡桃",
"skillF": "庇护·守护",
"skillV": "净天地·固甲",
"mid": 1000001
},
{
"player_name": "湖南软件.啊傑",
"hero_id": "迦南",
"skillF": "追魂·突刺",
"skillV": "寂静暗刑",
"mid": 1000004
},
{
"player_name": "湖南软件.龙鰲",
"hero_id": "季莹莹",
"skillF": "幽冥火·突焰",
"skillV": "无常锁·拘",
"mid": 1000021
}
],
"pick_rate": 0.5,
"average_score": 15.6,
"last_score": 7.1000000000000005
},
{
"team_name": "海口经济学院",
"players": [
{
"player_name": "海经院.原地寄",
"hero_id": "胡桃",
"skillF": "庇护·守护",
"skillV": "净天地·固甲",
"mid": 1000001
},
{
"player_name": "海经院.欢快信",
"hero_id": "特木尔",
"skillF": "风之精灵",
"skillV": "风之牢笼",
"mid": 1000005
},
{
"player_name": "海经院.亚风",
"hero_id": "武田信忠",
"skillF": "白刃取",
"skillV": "封印解除·噬",
"mid": 1000016
}
],
"pick_rate": 0.33,
"average_score": 4.8,
"last_score": 16.3
},
{
"team_name": "东大成贤学院",
"players": [
{
"player_name": "东大成贤.CC",
"hero_id": "胡桃",
"skillF": "庇护·守护",
"skillV": "净天地·固甲",
"mid": 1000001
},
{
"player_name": "东大成贤.小雨",
"hero_id": "迦南",
"skillF": "追魂·突刺",
"skillV": "寂静暗刑",
"mid": 1000004
},
{
"player_name": "东大成贤.为梦",
"hero_id": "季莹莹",
"skillF": "幽冥火·突焰",
"skillV": "无常锁·拘",
"mid": 1000021
}
],
"pick_rate": 0.33,
"average_score": 10.1,
"last_score": 0.5
},
{
"team_name": "西京学院",
"players": [
{
"player_name": "西京.木木",
"hero_id": "宁红夜",
"skillF": "昆仑诀·封",
"skillV": "赤练无明",
"mid": 1000003
},
{
"player_name": "西京.狂言",
"hero_id": "特木尔",
"skillF": "风之精灵·追踪",
"skillV": "风之牢笼·召唤",
"mid": 1000005
},
{
"player_name": "西京.卿九",
"hero_id": "季莹莹",
"skillF": "幽冥火·突焰",
"skillV": "无常锁·拘",
"mid": 1000021
}
],
"pick_rate": 0.17,
"average_score": 7.1,
"last_score": 2.2
},
{
"team_name": "重庆交通大学",
"players": [
{
"player_name": "重庆交大.哆点",
"hero_id": "胡桃",
"skillF": "庇护·守护",
"skillV": "净天地·固甲",
"mid": 1000001
},
{
"player_name": "重庆交大.泡泡",
"hero_id": "迦南",
"skillF": "追魂·突刺",
"skillV": "寂静暗刑",
"mid": 1000004
},
{
"player_name": "重庆交大.zy",
"hero_id": "季莹莹",
"skillF": "幽冥火·突焰",
"skillV": "无常锁·拘",
"mid": 1000021
}
],
"pick_rate": 0.33,
"average_score": 7.2,
"last_score": 12.3
},
{
"team_name": "华北理工大学",
"players": [
{
"player_name": "华北理工.89ms",
"hero_id": "胡桃",
"skillF": "庇护·守护",
"skillV": "净天地·固甲",
"mid": 1000001
},
{
"player_name": "华北理工.59ms",
"hero_id": "天海",
"skillF": "金钟罩",
"skillV": "金刚伏魔",
"mid": 1000007
},
{
"player_name": "华北理工.58ms",
"hero_id": "岳山",
"skillF": "陷阵·猛志",
"skillV": "千军辟易",
"mid": 1000011
}
],
"pick_rate": 0.17,
"average_score": 0.0,
"last_score": 1.0
}
],
"map": "聚窟洲"
}
"""
    return jsonstr

# 跳点坐标，计算
def CapBornPos():
    jsonstr = """
{
"data": [
{
"team_name": "河南大学",
"players": [
{
"player_name": "河南大学.Rose",
"born_postion": {
"x": 1826.75,
"y": 53.30373764038086,
"z": 1116.75
}
},
{
"player_name": "河南大学.天",
"born_postion": {
"x": 1823.25,
"y": 58.018104553222656,
"z": 1095.75
}
},
{
"player_name": "河南大学.萧宝",
"born_postion": {
"x": 1808.25,
"y": 57.20766067504883,
"z": 1143.25
}
}
]
},
{
"team_name": "辽宁广告职院",
"players": [
{
"player_name": "辽广.小染神",
"born_postion": {
"x": 1564.75,
"y": 97.03981018066406,
"z": 961.25
}
},
{
"player_name": "辽广.小金",
"born_postion": {
"x": 1537.75,
"y": 95.67929077148438,
"z": 1018.2500610351562
}
},
{
"player_name": "辽广.96",
"born_postion": {
"x": 1570.25,
"y": 98.52301025390625,
"z": 1018.75
}
}
]
},
{
"team_name": "浙江交通职院",
"players": [
{
"player_name": "浙江交通.小牛",
"born_postion": {
"x": 1070.25,
"y": 97.83528137207031,
"z": 836.750244140625
}
},
{
"player_name": "浙江交通.花花",
"born_postion": {
"x": 1034.75,
"y": 98.14872741699219,
"z": 839.2499389648438
}
},
{
"player_name": "浙江交通.小洛",
"born_postion": {
"x": 1052.75,
"y": 101.07557678222656,
"z": 997.25
}
}
]
},
{
"team_name": "湖南财政学院",
"players": [
{
"player_name": "湖财大.Raki",
"born_postion": {
"x": 1357.250244140625,
"y": 220.2206573486328,
"z": 1558.750244140625
}
},
{
"player_name": "湖财大.玉龙",
"born_postion": {
"x": 1390.25,
"y": 208.97193908691406,
"z": 1543.25
}
},
{
"player_name": "湖财大.小炫",
"born_postion": {
"x": 1375.7503662109375,
"y": 222.7877655029297,
"z": 1564.250244140625
}
}
]
},
{
"team_name": "西安体育学院",
"players": [
{
"player_name": "西体.不眠",
"born_postion": {
"x": 650.25,
"y": 67.8427505493164,
"z": 933.25
}
},
{
"player_name": "西体.Reze",
"born_postion": {
"x": 686.75,
"y": 87.32207489013672,
"z": 927.7501220703125
}
},
{
"player_name": "西体.北北",
"born_postion": {
"x": 689.25,
"y": 82.43487548828125,
"z": 939.75
}
}
]
},
{
"team_name": "南京邮电大学",
"players": [
{
"player_name": "南邮.咖飞",
"born_postion": {
"x": 1735.749755859375,
"y": 66.08392333984375,
"z": 1098.2501220703125
}
},
{
"player_name": "南邮.再等",
"born_postion": {
"x": 1756.75,
"y": 58.322811126708984,
"z": 1128.75
}
},
{
"player_name": "南邮.啵啵鱼",
"born_postion": {
"x": 1789.2498779296875,
"y": 57.92345428466797,
"z": 1101.75
}
}
]
},
{
"team_name": "湖南软件大学",
"players": [
{
"player_name": "湖南软件.子芊",
"born_postion": {
"x": 869.75,
"y": 54.334651947021484,
"z": 516.75
}
},
{
"player_name": "湖南软件.啊傑",
"born_postion": {
"x": 881.75,
"y": 55.523040771484375,
"z": 570.25
}
},
{
"player_name": "湖南软件.龙鰲",
"born_postion": {
"x": 848.25,
"y": 55.189781188964844,
"z": 546.25
}
}
]
},
{
"team_name": "海口经济学院",
"players": [
{
"player_name": "海经院.原地寄",
"born_postion": {
"x": 1351.7501220703125,
"y": 210.0722198486328,
"z": 1582.75
}
},
{
"player_name": "海经院.欢快信",
"born_postion": {
"x": 1378.250244140625,
"y": 240.4336395263672,
"z": 1567.7501220703125
}
},
{
"player_name": "海经院.亚风",
"born_postion": {
"x": 1372.750244140625,
"y": 223.678466796875,
"z": 1561.750244140625
}
}
]
},
{
"team_name": "东大成贤学院",
"players": [
{
"player_name": "东大成贤.CC",
"born_postion": {
"x": 1588.75,
"y": 95.34420013427734,
"z": 991.75
}
},
{
"player_name": "东大成贤.小雨",
"born_postion": {
"x": 1579.25,
"y": 95.34420013427734,
"z": 988.25
}
},
{
"player_name": "东大成贤.为梦",
"born_postion": {
"x": 1570.25,
"y": 98.80661010742188,
"z": 1009.2501831054688
}
}
]
},
{
"team_name": "西京学院",
"players": [
{
"player_name": "西京.木木",
"born_postion": {
"x": 1366.2501220703125,
"y": 219.84559631347656,
"z": 1576.750244140625
}
},
{
"player_name": "西京.狂言",
"born_postion": {
"x": 1399.250244140625,
"y": 221.24276733398438,
"z": 1552.7501220703125
}
},
{
"player_name": "西京.卿九",
"born_postion": {
"x": 1405.750244140625,
"y": 223.0208740234375,
"z": 1543.750244140625
}
}
]
},
{
"team_name": "重庆交通大学",
"players": [
{
"player_name": "重庆交大.哆点",
"born_postion": {
"x": 698.25,
"y": 82.52459716796875,
"z": 921.25
}
},
{
"player_name": "重庆交大.泡泡",
"born_postion": {
"x": 683.7501831054688,
"y": 88.24859619140625,
"z": 936.2498779296875
}
},
{
"player_name": "重庆交大.zy",
"born_postion": {
"x": 671.25,
"y": 83.05378723144531,
"z": 900.25
}
}
]
},
{
"team_name": "华北理工大学",
"players": [
{
"player_name": "华北理工.89ms",
"born_postion": {
"x": 1122.75,
"y": 76.79505157470703,
"z": 208.75
}
},
{
"player_name": "华北理工.59ms",
"born_postion": {
"x": 1125.25,
"y": 76.368408203125,
"z": 223.75
}
},
{
"player_name": "华北理工.58ms",
"born_postion": {
"x": 1104.75,
"y": 73.58877563476562,
"z": 247.75
}
}
]
}
],
"map": "聚窟洲"
}
"""
    return jsonstr

# 单局积分，计算
def CapSingleScore():
    jsonstr = """
{
"data": [
{
"rank": 1,
"srv_rank": 1,
"team_name": "浙江交通职院",
"players": [
{
"player_name": "浙江交通.小牛"
},
{
"player_name": "浙江交通.花花"
},
{
"player_name": "浙江交通.小洛"
}
],
"kill_times": 15,
"kill_score": 21.0,
"rank_score": 4.0,
"score": 25.0
},
{
"rank": 2,
"srv_rank": 4,
"team_name": "西安体育学院",
"players": [
{
"player_name": "西体.不眠"
},
{
"player_name": "西体.Reze"
},
{
"player_name": "西体.北北"
}
],
"kill_times": 12,
"kill_score": 15.600000000000001,
"rank_score": 1.5,
"score": 17.1
},
{
"rank": 3,
"srv_rank": 6,
"team_name": "湖南软件大学",
"players": [
{
"player_name": "湖南软件.子芊"
},
{
"player_name": "湖南软件.啊傑"
},
{
"player_name": "湖南软件.龙鰲"
}
],
"kill_times": 12,
"kill_score": 14.399999999999999,
"rank_score": 1.0,
"score": 15.399999999999999
},
{
"rank": 4,
"srv_rank": 2,
"team_name": "河南大学",
"players": [
{
"player_name": "河南大学.Rose"
},
{
"player_name": "河南大学.天"
},
{
"player_name": "河南大学.萧宝"
}
],
"kill_times": 9,
"kill_score": 12.599999999999998,
"rank_score": 2.5,
"score": 15.099999999999998
},
{
"rank": 5,
"srv_rank": 5,
"team_name": "东大成贤学院",
"players": [
{
"player_name": "东大成贤.CC"
},
{
"player_name": "东大成贤.小雨"
},
{
"player_name": "东大成贤.为梦"
}
],
"kill_times": 11,
"kill_score": 13.2,
"rank_score": 1.5,
"score": 14.7
},
{
"rank": 6,
"srv_rank": 7,
"team_name": "辽宁广告职院",
"players": [
{
"player_name": "辽广.小染神"
},
{
"player_name": "辽广.小金"
},
{
"player_name": "辽广.96"
}
],
"kill_times": 7,
"kill_score": 7.700000000000001,
"rank_score": 1.0,
"score": 8.700000000000001
},
{
"rank": 7,
"srv_rank": 8,
"team_name": "西京学院",
"players": [
{
"player_name": "西京.木木"
},
{
"player_name": "西京.狂言"
},
{
"player_name": "西京.卿九"
}
],
"kill_times": 6,
"kill_score": 6.6000000000000005,
"rank_score": 0.5,
"score": 7.1000000000000005
},
{
"rank": 8,
"srv_rank": 11,
"team_name": "南京邮电大学",
"players": [
{
"player_name": "南邮.咖飞"
},
{
"player_name": "南邮.再等"
},
{
"player_name": "南邮.啵啵鱼"
}
],
"kill_times": 5,
"kill_score": 5.0,
"rank_score": 0.0,
"score": 5.0
},
{
"rank": 9,
"srv_rank": 9,
"team_name": "湖南财政学院",
"players": [
{
"player_name": "湖财大.Raki"
},
{
"player_name": "湖财大.玉龙"
},
{
"player_name": "湖财大.小炫"
}
],
"kill_times": 3,
"kill_score": 3.0,
"rank_score": 0.5,
"score": 3.5
},
{
"rank": 10,
"srv_rank": 3,
"team_name": "重庆交通大学",
"players": [
{
"player_name": "重庆交大.哆点"
},
{
"player_name": "重庆交大.泡泡"
},
{
"player_name": "重庆交大.zy"
}
],
"kill_times": 0,
"kill_score": 0.0,
"rank_score": 2.0,
"score": 2.0
},
{
"rank": 11,
"srv_rank": 10,
"team_name": "海口经济学院",
"players": [
{
"player_name": "海经院.原地寄"
},
{
"player_name": "海经院.欢快信"
},
{
"player_name": "海经院.亚风"
}
],
"kill_times": 1,
"kill_score": 1.0,
"rank_score": 0.5,
"score": 1.5
},
{
"rank": 12,
"srv_rank": 12,
"team_name": "华北理工大学",
"players": [
{
"player_name": "华北理工.89ms"
},
{
"player_name": "华北理工.59ms"
},
{
"player_name": "华北理工.58ms"
}
],
"kill_times": 0,
"kill_score": 0.0,
"rank_score": 0.0,
"score": 0.0
}
]
}
"""
    return jsonstr

# 总积分，计算
def CapTotalScore():
    jsonstr = """
    {
"data": [
{
"rank": 1,
"team_name": "浙江交通职院",
"players": [
{
"player_name": "浙江交通.小牛"
},
{
"player_name": "浙江交通.花花"
},
{
"player_name": "浙江交通.小洛"
}
],
"score1": 14.500000000000002,
"isfirst1": 0,
"score2": 33.400000000000006,
"isfirst2": 1,
"score3": 0.5,
"isfirst3": 0,
"score4": 30.6,
"isfirst4": 1,
"score5": 3.5,
"isfirst5": 0,
"score6": 25.0,
"isfirst": 1,
"totalscore": 107.5
},
{
"rank": 2,
"team_name": "河南大学",
"players": [
{
"player_name": "河南大学.Rose"
},
{
"player_name": "河南大学.天"
},
{
"player_name": "河南大学.萧宝"
}
],
"score1": 32.0,
"isfirst1": 1,
"score2": 10.5,
"isfirst2": 0,
"score3": 12.3,
"isfirst3": 0,
"score4": 8.1,
"isfirst4": 0,
"score5": 14.5,
"isfirst5": 0,
"score6": 15.099999999999998,
"isfirst": 0,
"totalscore": 92.5
},
{
"rank": 3,
"team_name": "重庆交通大学",
"players": [
{
"player_name": "重庆交大.哆点"
},
{
"player_name": "重庆交大.泡泡"
},
{
"player_name": "重庆交大.zy"
}
],
"score1": 10.599999999999998,
"isfirst1": 0,
"score2": 10.6,
"isfirst2": 0,
"score3": 29.1,
"isfirst3": 0,
"score4": 10.9,
"isfirst4": 0,
"score5": 12.3,
"isfirst5": 0,
"score6": 2.0,
"isfirst": 0,
"totalscore": 75.5
},
{
"rank": 4,
"team_name": "湖南财政学院",
"players": [
{
"player_name": "湖财大.Raki"
},
{
"player_name": "湖财大.玉龙"
},
{
"player_name": "湖财大.小炫"
}
],
"score1": 6.699999999999999,
"isfirst1": 0,
"score2": 13.7,
"isfirst2": 0,
"score3": 14.200000000000001,
"isfirst3": 0,
"score4": 2.2,
"isfirst4": 0,
"score5": 34.8,
"isfirst5": 1,
"score6": 3.5,
"isfirst": 0,
"totalscore": 75.1
},
{
"rank": 5,
"team_name": "海口经济学院",
"players": [
{
"player_name": "海经院.原地寄"
},
{
"player_name": "海经院.欢快信"
},
{
"player_name": "海经院.亚风"
}
],
"score1": 7.2,
"isfirst1": 0,
"score2": 8.2,
"isfirst2": 0,
"score3": 0.0,
"isfirst3": 0,
"score4": 26.2,
"isfirst4": 0,
"score5": 16.3,
"isfirst5": 0,
"score6": 1.5,
"isfirst": 0,
"totalscore": 59.4
},
{
"rank": 6,
"team_name": "湖南软件大学",
"players": [
{
"player_name": "湖南软件.子芊"
},
{
"player_name": "湖南软件.啊傑"
},
{
"player_name": "湖南软件.龙鰲"
}
],
"score1": 1.0,
"isfirst1": 0,
"score2": 20.7,
"isfirst2": 0,
"score3": 10.600000000000001,
"isfirst3": 0,
"score4": 1.0,
"isfirst4": 0,
"score5": 7.1000000000000005,
"isfirst5": 0,
"score6": 15.399999999999999,
"isfirst": 0,
"totalscore": 55.8
},
{
"rank": 7,
"team_name": "西安体育学院",
"players": [
{
"player_name": "西体.不眠"
},
{
"player_name": "西体.Reze"
},
{
"player_name": "西体.北北"
}
],
"score1": "-",
"isfirst1": 0,
"score2": 5.1,
"isfirst2": 0,
"score3": 2.5,
"isfirst3": 0,
"score4": 4.5,
"isfirst4": 0,
"score5": 26.300000000000004,
"isfirst5": 0,
"score6": 17.1,
"isfirst": 0,
"totalscore": 55.5
},
{
"rank": 8,
"team_name": "西京学院",
"players": [
{
"player_name": "西京.木木"
},
{
"player_name": "西京.狂言"
},
{
"player_name": "西京.卿九"
}
],
"score1": 5.4,
"isfirst1": 0,
"score2": 9.8,
"isfirst2": 0,
"score3": 12.4,
"isfirst3": 0,
"score4": 7.5,
"isfirst4": 0,
"score5": 2.2,
"isfirst5": 0,
"score6": 7.1000000000000005,
"isfirst": 0,
"totalscore": 44.4
},
{
"rank": 9,
"team_name": "南京邮电大学",
"players": [
{
"player_name": "南邮.咖飞"
},
{
"player_name": "南邮.再等"
},
{
"player_name": "南邮.啵啵鱼"
}
],
"score1": 4.5,
"isfirst1": 0,
"score2": 3.5,
"isfirst2": 0,
"score3": 23.6,
"isfirst3": 1,
"score4": 3.8000000000000003,
"isfirst4": 0,
"score5": 1.0,
"isfirst5": 0,
"score6": 5.0,
"isfirst": 0,
"totalscore": 41.4
},
{
"rank": 10,
"team_name": "东大成贤学院",
"players": [
{
"player_name": "东大成贤.CC"
},
{
"player_name": "东大成贤.小雨"
},
{
"player_name": "东大成贤.为梦"
}
],
"score1": 5.5,
"isfirst1": 0,
"score2": 1.0,
"isfirst2": 0,
"score3": 4.6,
"isfirst3": 0,
"score4": 15.0,
"isfirst4": 0,
"score5": 0.5,
"isfirst5": 0,
"score6": 14.7,
"isfirst": 0,
"totalscore": 41.3
},
{
"rank": 11,
"team_name": "辽宁广告职院",
"players": [
{
"player_name": "辽广.小染神"
},
{
"player_name": "辽广.小金"
},
{
"player_name": "辽广.96"
}
],
"score1": 3.9,
"isfirst1": 0,
"score2": 3.0,
"isfirst2": 0,
"score3": 3.0,
"isfirst3": 0,
"score4": 5.5,
"isfirst4": 0,
"score5": 9.8,
"isfirst5": 0,
"score6": 8.700000000000001,
"isfirst": 0,
"totalscore": 33.9
},
{
"rank": 12,
"team_name": "华北理工大学",
"players": [
{
"player_name": "华北理工.89ms"
},
{
"player_name": "华北理工.59ms"
},
{
"player_name": "华北理工.58ms"
}
],
"score1": 10.4,
"isfirst1": 0,
"score2": 1.6,
"isfirst2": 0,
"score3": 2.5,
"isfirst3": 0,
"score4": 0.0,
"isfirst4": 0,
"score5": 1.0,
"isfirst5": 0,
"score6": 0.0,
"isfirst": 0,
"totalscore": 15.5
}
]
}
"""
    return jsonstr

# 赛后战队数据，计算
def CapMatchEndData():
    jsonstr = """
{
"data": [
{
"rank": 1,
"team_name": "浙江交通职院",
"kill_score": 21.0,
"rank_score": 4.0,
"score": 25.0,
"players": [
{
"player_name": "浙江交通.小牛",
"hero": "宁红夜",
"skill1": "昆仑诀·禁疗",
"skill2": "赤练无明·无拘",
"kill_times": 8,
"cure": 7559.0,
"damage": 20902.0,
"assist_count": 6,
"total_live_time": 1556.594315290451,
"rescue_times": 0
},
{
"player_name": "浙江交通.花花",
"hero": "无尘",
"skill1": "两仪剑",
"skill2": "斗转星移",
"kill_times": 3,
"cure": 6539.0,
"damage": 8907.0,
"assist_count": 6,
"total_live_time": 1556.594315290451,
"rescue_times": 0
},
{
"player_name": "浙江交通.小洛",
"hero": "玉玲珑",
"skill1": "尾袭",
"skill2": "迷魂引",
"kill_times": 4,
"cure": 8028.0,
"damage": 10553.0,
"assist_count": 8,
"total_live_time": 1556.594315290451,
"rescue_times": 0
}
]
},
{
"rank": 2,
"team_name": "西安体育学院",
"kill_score": 15.600000000000001,
"rank_score": 1.5,
"score": 17.1,
"players": [
{
"player_name": "西体.不眠",
"hero": "宁红夜",
"skill1": "昆仑诀·禁疗",
"skill2": "赤练无明",
"kill_times": 5,
"cure": 10070.0,
"damage": 21440.0,
"assist_count": 5,
"total_live_time": 1332.537386894226,
"rescue_times": 0
},
{
"player_name": "西体.Reze",
"hero": "无尘",
"skill1": "两仪剑",
"skill2": "斗转星移",
"kill_times": 6,
"cure": 14937.0,
"damage": 14192.0,
"assist_count": 5,
"total_live_time": 1440.7101747989655,
"rescue_times": 1
},
{
"player_name": "西体.北北",
"hero": "玉玲珑",
"skill1": "尾袭",
"skill2": "迷魂引",
"kill_times": 1,
"cure": 10006.0,
"damage": 11593.0,
"assist_count": 7,
"total_live_time": 1375.5054144859314,
"rescue_times": 1
}
]
},
{
"rank": 3,
"team_name": "湖南软件大学",
"kill_score": 14.399999999999999,
"rank_score": 1.0,
"score": 15.399999999999999,
"players": [
{
"player_name": "湖南软件.子芊",
"hero": "胡桃",
"skill1": "庇护·守护",
"skill2": "净天地·固甲",
"kill_times": 3,
"cure": 21386.0,
"damage": 19247.0,
"assist_count": 9,
"total_live_time": 1038.0722744464874,
"rescue_times": 1
},
{
"player_name": "湖南软件.啊傑",
"hero": "迦南",
"skill1": "追魂·突刺",
"skill2": "寂静暗刑",
"kill_times": 0,
"cure": 5074.0,
"damage": 11235.0,
"assist_count": 7,
"total_live_time": 996.0158059597015,
"rescue_times": 0
},
{
"player_name": "湖南软件.龙鰲",
"hero": "季莹莹",
"skill1": "幽冥火·突焰",
"skill2": "无常锁·拘",
"kill_times": 9,
"cure": 8800.0,
"damage": 20784.0,
"assist_count": 1,
"total_live_time": 998.2221677303314,
"rescue_times": 1
}
]
},
{
"rank": 4,
"team_name": "河南大学",
"kill_score": 12.599999999999998,
"rank_score": 2.5,
"score": 15.099999999999998,
"players": [
{
"player_name": "河南大学.Rose",
"hero": "宁红夜",
"skill1": "昆仑诀·禁疗",
"skill2": "赤练无明·无拘",
"kill_times": 3,
"cure": 4226.0,
"damage": 15090.0,
"assist_count": 5,
"total_live_time": 1320.3719310760498,
"rescue_times": 0
},
{
"player_name": "河南大学.天",
"hero": "无尘",
"skill1": "两仪剑",
"skill2": "斗转星移",
"kill_times": 3,
"cure": 6488.0,
"damage": 7506.0,
"assist_count": 4,
"total_live_time": 1315.37539935112,
"rescue_times": 1
},
{
"player_name": "河南大学.萧宝",
"hero": "玉玲珑",
"skill1": "尾袭",
"skill2": "迷魂引",
"kill_times": 3,
"cure": 7194.0,
"damage": 12118.0,
"assist_count": 5,
"total_live_time": 1417.8299887180328,
"rescue_times": 1
}
]
},
{
"rank": 5,
"team_name": "东大成贤学院",
"kill_score": 13.2,
"rank_score": 1.5,
"score": 14.7,
"players": [
{
"player_name": "东大成贤.CC",
"hero": "胡桃",
"skill1": "庇护·守护",
"skill2": "净天地·固甲",
"kill_times": 4,
"cure": 13447.0,
"damage": 10824.0,
"assist_count": 6,
"total_live_time": 1164.6317691802979,
"rescue_times": 2
},
{
"player_name": "东大成贤.小雨",
"hero": "迦南",
"skill1": "追魂·突刺",
"skill2": "寂静暗刑",
"kill_times": 3,
"cure": 3708.0,
"damage": 14449.0,
"assist_count": 7,
"total_live_time": 1149.1140859127045,
"rescue_times": 0
},
{
"player_name": "东大成贤.为梦",
"hero": "季莹莹",
"skill1": "幽冥火·突焰",
"skill2": "无常锁·拘",
"kill_times": 4,
"cure": 6249.0,
"damage": 22221.0,
"assist_count": 7,
"total_live_time": 1178.2816491127014,
"rescue_times": 1
}
]
},
{
"rank": 6,
"team_name": "辽宁广告职院",
"kill_score": 7.700000000000001,
"rank_score": 1.0,
"score": 8.700000000000001,
"players": [
{
"player_name": "辽广.小染神",
"hero": "宁红夜",
"skill1": "昆仑诀·禁疗",
"skill2": "赤练无明",
"kill_times": 3,
"cure": 11968.0,
"damage": 14133.0,
"assist_count": 3,
"total_live_time": 1060.9407362937927,
"rescue_times": 0
},
{
"player_name": "辽广.小金",
"hero": "无尘",
"skill1": "两仪剑",
"skill2": "斗转星移",
"kill_times": 4,
"cure": 4323.0,
"damage": 9463.0,
"assist_count": 3,
"total_live_time": 1039.6206452846527,
"rescue_times": 0
},
{
"player_name": "辽广.96",
"hero": "玉玲珑",
"skill1": "尾袭",
"skill2": "迷魂引",
"kill_times": 0,
"cure": 2398.0,
"damage": 7042.0,
"assist_count": 4,
"total_live_time": 1025.3966722488403,
"rescue_times": 0
}
]
},
{
"rank": 7,
"team_name": "西京学院",
"kill_score": 6.6000000000000005,
"rank_score": 0.5,
"score": 7.1000000000000005,
"players": [
{
"player_name": "西京.木木",
"hero": "宁红夜",
"skill1": "昆仑诀·封",
"skill2": "赤练无明",
"kill_times": 2,
"cure": 743.0,
"damage": 5264.0,
"assist_count": 3,
"total_live_time": 890.7267470359802,
"rescue_times": 0
},
{
"player_name": "西京.狂言",
"hero": "特木尔",
"skill1": "风之精灵·追踪",
"skill2": "风之牢笼·召唤",
"kill_times": 2,
"cure": 1515.0,
"damage": 6656.0,
"assist_count": 2,
"total_live_time": 943.5129854679108,
"rescue_times": 0
},
{
"player_name": "西京.卿九",
"hero": "季莹莹",
"skill1": "幽冥火·突焰",
"skill2": "无常锁·拘",
"kill_times": 2,
"cure": 451.0,
"damage": 8464.0,
"assist_count": 2,
"total_live_time": 847.0769257545471,
"rescue_times": 0
}
]
},
{
"rank": 8,
"team_name": "南京邮电大学",
"kill_score": 5.0,
"rank_score": 0.0,
"score": 5.0,
"players": [
{
"player_name": "南邮.咖飞",
"hero": "胡桃",
"skill1": "庇护·守护",
"skill2": "净天地·固甲",
"kill_times": 0,
"cure": 11330.0,
"damage": 4050.0,
"assist_count": 2,
"total_live_time": 693.4613740444183,
"rescue_times": 0
},
{
"player_name": "南邮.再等",
"hero": "迦南",
"skill1": "追魂·突刺",
"skill2": "寂静暗刑",
"kill_times": 3,
"cure": 1491.0,
"damage": 9338.0,
"assist_count": 2,
"total_live_time": 745.4982907772064,
"rescue_times": 0
},
{
"player_name": "南邮.啵啵鱼",
"hero": "季莹莹",
"skill1": "幽冥火·突焰",
"skill2": "无常锁·拘",
"kill_times": 2,
"cure": 1485.0,
"damage": 13308.0,
"assist_count": 3,
"total_live_time": 720.4856672286987,
"rescue_times": 0
}
]
},
{
"rank": 9,
"team_name": "湖南财政学院",
"kill_score": 3.0,
"rank_score": 0.5,
"score": 3.5,
"players": [
{
"player_name": "湖财大.Raki",
"hero": "迦南",
"skill1": "追魂·突刺",
"skill2": "寂静暗刑",
"kill_times": 0,
"cure": 605.0,
"damage": 3844.0,
"assist_count": 3,
"total_live_time": 794.751442193985,
"rescue_times": 0
},
{
"player_name": "湖财大.玉龙",
"hero": "殷紫萍",
"skill1": "益气安魂",
"skill2": "悬瓠济世",
"kill_times": 1,
"cure": 7329.0,
"damage": 1910.0,
"assist_count": 0,
"total_live_time": 771.0574431419373,
"rescue_times": 0
},
{
"player_name": "湖财大.小炫",
"hero": "季莹莹",
"skill1": "幽冥火·突焰",
"skill2": "无常锁·拘",
"kill_times": 2,
"cure": 1963.0,
"damage": 12704.0,
"assist_count": 1,
"total_live_time": 858.3455865383148,
"rescue_times": 0
}
]
},
{
"rank": 10,
"team_name": "重庆交通大学",
"kill_score": 0.0,
"rank_score": 2.0,
"score": 2.0,
"players": [
{
"player_name": "重庆交大.哆点",
"hero": "胡桃",
"skill1": "庇护·守护",
"skill2": "净天地·固甲",
"kill_times": 0,
"cure": 10690.0,
"damage": 3304.0,
"assist_count": 0,
"total_live_time": 666.1259908676147,
"rescue_times": 0
},
{
"player_name": "重庆交大.泡泡",
"hero": "迦南",
"skill1": "追魂·突刺",
"skill2": "寂静暗刑",
"kill_times": 0,
"cure": 2853.0,
"damage": 3916.0,
"assist_count": 0,
"total_live_time": 1054.9248597621918,
"rescue_times": 1
},
{
"player_name": "重庆交大.zy",
"hero": "季莹莹",
"skill1": "幽冥火·突焰",
"skill2": "无常锁·拘",
"kill_times": 0,
"cure": 7121.0,
"damage": 5138.0,
"assist_count": 0,
"total_live_time": 1330.1527087688446,
"rescue_times": 0
}
]
},
{
"rank": 11,
"team_name": "海口经济学院",
"kill_score": 1.0,
"rank_score": 0.5,
"score": 1.5,
"players": [
{
"player_name": "海经院.原地寄",
"hero": "胡桃",
"skill1": "庇护·守护",
"skill2": "净天地·固甲",
"kill_times": 0,
"cure": 11560.0,
"damage": 6302.0,
"assist_count": 1,
"total_live_time": 783.7568776607513,
"rescue_times": 2
},
{
"player_name": "海经院.欢快信",
"hero": "特木尔",
"skill1": "风之精灵",
"skill2": "风之牢笼",
"kill_times": 0,
"cure": 4452.0,
"damage": 8008.0,
"assist_count": 1,
"total_live_time": 764.8281061649323,
"rescue_times": 0
},
{
"player_name": "海经院.亚风",
"hero": "武田信忠",
"skill1": "白刃取",
"skill2": "封印解除·噬",
"kill_times": 1,
"cure": 3350.0,
"damage": 3947.0,
"assist_count": 0,
"total_live_time": 588.0922803878784,
"rescue_times": 0
}
]
},
{
"rank": 12,
"team_name": "华北理工大学",
"kill_score": 0.0,
"rank_score": 0.0,
"score": 0.0,
"players": [
{
"player_name": "华北理工.89ms",
"hero": "胡桃",
"skill1": "庇护·守护",
"skill2": "净天地·固甲",
"kill_times": 0,
"cure": 4718.0,
"damage": 3576.0,
"assist_count": 0,
"total_live_time": 471.5152635574341,
"rescue_times": 0
},
{
"player_name": "华北理工.59ms",
"hero": "天海",
"skill1": "金钟罩",
"skill2": "金刚伏魔",
"kill_times": 0,
"cure": 0.0,
"damage": 1562.0,
"assist_count": 0,
"total_live_time": 448.05690717697144,
"rescue_times": 0
},
{
"player_name": "华北理工.58ms",
"hero": "岳山",
"skill1": "陷阵·猛志",
"skill2": "千军辟易",
"kill_times": 0,
"cure": 1100.0,
"damage": 4376.0,
"assist_count": 0,
"total_live_time": 487.1819167137146,
"rescue_times": 0
}
]
}
]
}
"""
    return jsonstr

# 击杀榜前十数据，计算
def CapTop10():
    jsonstr = """
{
"data": [
{
"team_name": "浙江交通职院",
"player_name": "浙江交通.小牛",
"kill_times": 30,
"damage": 126981.0,
"rank": 1
},
{
"team_name": "河南大学",
"player_name": "河南大学.萧宝",
"kill_times": 25,
"damage": 113391.0,
"rank": 2
},
{
"team_name": "湖南财政学院",
"player_name": "湖财大.小炫",
"kill_times": 23,
"damage": 118395.0,
"rank": 3
},
{
"team_name": "河南大学",
"player_name": "河南大学.Rose",
"kill_times": 21,
"damage": 71119.0,
"rank": 4
},
{
"team_name": "湖南软件大学",
"player_name": "湖南软件.龙鰲",
"kill_times": 20,
"damage": 92502.0,
"rank": 5
},
{
"team_name": "重庆交通大学",
"player_name": "重庆交大.泡泡",
"kill_times": 20,
"damage": 76187.90487575531,
"rank": 6
},
{
"team_name": "浙江交通职院",
"player_name": "浙江交通.小洛",
"kill_times": 20,
"damage": 59961.0,
"rank": 7
},
{
"team_name": "浙江交通职院",
"player_name": "浙江交通.花花",
"kill_times": 18,
"damage": 88862.0,
"rank": 8
},
{
"team_name": "重庆交通大学",
"player_name": "重庆交大.zy",
"kill_times": 18,
"damage": 79791.0,
"rank": 9
},
{
"team_name": "湖南财政学院",
"player_name": "湖财大.玉龙",
"kill_times": 17,
"damage": 56555.0,
"rank": 10
}
]
}
"""
    return jsonstr

# 场均分数据，计算
def CapAvgScore():
    jsonstr = """
{
"data": [
{
"rank": 1,
"score": 107.5,
"team_name": "浙江交通职院",
"players": [
{
"player_name": "浙江交通.小牛"
},
{
"player_name": "浙江交通.花花"
},
{
"player_name": "浙江交通.小洛"
}
],
"avgscore": 17.916666666666668
},
{
"rank": 2,
"score": 92.5,
"team_name": "河南大学",
"players": [
{
"player_name": "河南大学.Rose"
},
{
"player_name": "河南大学.天"
},
{
"player_name": "河南大学.萧宝"
}
],
"avgscore": 15.416666666666666
},
{
"rank": 3,
"score": 75.5,
"team_name": "重庆交通大学",
"players": [
{
"player_name": "重庆交大.哆点"
},
{
"player_name": "重庆交大.泡泡"
},
{
"player_name": "重庆交大.zy"
}
],
"avgscore": 12.583333333333334
},
{
"rank": 4,
"score": 75.1,
"team_name": "湖南财政学院",
"players": [
{
"player_name": "湖财大.Raki"
},
{
"player_name": "湖财大.玉龙"
},
{
"player_name": "湖财大.小炫"
}
],
"avgscore": 12.516666666666666
},
{
"rank": 5,
"score": 59.4,
"team_name": "海口经济学院",
"players": [
{
"player_name": "海经院.原地寄"
},
{
"player_name": "海经院.欢快信"
},
{
"player_name": "海经院.亚风"
}
],
"avgscore": 9.9
},
{
"rank": 6,
"score": 55.8,
"team_name": "湖南软件大学",
"players": [
{
"player_name": "湖南软件.子芊"
},
{
"player_name": "湖南软件.啊傑"
},
{
"player_name": "湖南软件.龙鰲"
}
],
"avgscore": 9.299999999999999
},
{
"rank": 7,
"score": 55.5,
"team_name": "西安体育学院",
"players": [
{
"player_name": "西体.不眠"
},
{
"player_name": "西体.Reze"
},
{
"player_name": "西体.北北"
}
],
"avgscore": 9.25
},
{
"rank": 8,
"score": 44.4,
"team_name": "西京学院",
"players": [
{
"player_name": "西京.木木"
},
{
"player_name": "西京.狂言"
},
{
"player_name": "西京.卿九"
}
],
"avgscore": 7.3999999999999995
},
{
"rank": 9,
"score": 41.4,
"team_name": "南京邮电大学",
"players": [
{
"player_name": "南邮.咖飞"
},
{
"player_name": "南邮.再等"
},
{
"player_name": "南邮.啵啵鱼"
}
],
"avgscore": 6.8999999999999995
},
{
"rank": 10,
"score": 41.3,
"team_name": "东大成贤学院",
"players": [
{
"player_name": "东大成贤.CC"
},
{
"player_name": "东大成贤.小雨"
},
{
"player_name": "东大成贤.为梦"
}
],
"avgscore": 6.883333333333333
},
{
"rank": 11,
"score": 33.9,
"team_name": "辽宁广告职院",
"players": [
{
"player_name": "辽广.小染神"
},
{
"player_name": "辽广.小金"
},
{
"player_name": "辽广.96"
}
],
"avgscore": 5.6499999999999995
},
{
"rank": 12,
"score": 15.5,
"team_name": "华北理工大学",
"players": [
{
"player_name": "华北理工.89ms"
},
{
"player_name": "华北理工.59ms"
},
{
"player_name": "华北理工.58ms"
}
],
"avgscore": 2.5833333333333335
}
]
}

"""
    return jsonstr

# 每局战果数据，计算
def CapAllMatchScore():
    jsonstr = """
{
"data": [
{
"Match": 1,
"team_name": "河南大学",
"score": 32.0,
"players": [
{
"player_name": "河南大学.Rose"
},
{
"player_name": "河南大学.Rank"
},
{
"player_name": "河南大学.萧宝"
}
]
},
{
"Match": 2,
"team_name": "浙江交通职院",
"score": 33.400000000000006,
"players": [
{
"player_name": "浙江交通.小牛"
},
{
"player_name": "浙江交通.花花"
},
{
"player_name": "浙江交通.小洛"
}
]
},
{
"Match": 3,
"team_name": "南京邮电大学",
"score": 23.6,
"players": [
{
"player_name": "南邮.咖飞"
},
{
"player_name": "南邮.啵啵鱼"
},
{
"player_name": "南邮.再等"
}
]
},
{
"Match": 4,
"team_name": "浙江交通职院",
"score": 30.6,
"players": [
{
"player_name": "浙江交通.小洛"
},
{
"player_name": "浙江交通.小牛"
},
{
"player_name": "浙江交通.花花"
}
]
},
{
"Match": 5,
"team_name": "湖南财政学院",
"score": 34.8,
"players": [
{
"player_name": "湖财大.玉龙"
},
{
"player_name": "湖财大.Raki"
},
{
"player_name": "湖财大.小炫"
}
]
},
{
"Match": 6,
"team_name": "浙江交通职院",
"score": 25.0,
"players": [
{
"player_name": "浙江交通.小牛"
},
{
"player_name": "浙江交通.花花"
},
{
"player_name": "浙江交通.小洛"
}
]
}
]
}
"""
    return jsonstr

# 实时生存
def CapRealtimeLive():
    jsonstr = """
{
"data": [
{
"team_name": "河南大学",
"players": [
{
"player_name": "河南大学.Rose",
"player_state": 2,
"hero": "宁红夜"
},
{
"player_name": "河南大学.天",
"player_state": 2,
"hero": "无尘"
},
{
"player_name": "河南大学.萧宝",
"player_state": 2,
"hero": "玉玲珑"
}
],
"team_state": 2,
"score": 15.1,
"total_score": 92.5,
"kill": 9,
"rank": 2
},
{
"team_name": "辽宁广告职院",
"players": [
{
"player_name": "辽广.小染神",
"player_state": 2,
"hero": "宁红夜"
},
{
"player_name": "辽广.小金",
"player_state": 2,
"hero": "无尘"
},
{
"player_name": "辽广.96",
"player_state": 2,
"hero": "玉玲珑"
}
],
"team_state": 2,
"score": 8.7,
"total_score": 33.9,
"kill": 7,
"rank": 11
},
{
"team_name": "浙江交通职院",
"players": [
{
"player_name": "浙江交通.小牛",
"player_state": 1,
"hero": "宁红夜"
},
{
"player_name": "浙江交通.花花",
"player_state": 1,
"hero": "无尘"
},
{
"player_name": "浙江交通.小洛",
"player_state": 1,
"hero": "玉玲珑"
}
],
"team_state": 1,
"score": 25.0,
"total_score": 107.5,
"kill": 15,
"rank": 1
},
{
"team_name": "湖南财政学院",
"players": [
{
"player_name": "湖财大.Raki",
"player_state": 2,
"hero": "迦南"
},
{
"player_name": "湖财大.玉龙",
"player_state": 2,
"hero": "殷紫萍"
},
{
"player_name": "湖财大.小炫",
"player_state": 2,
"hero": "季莹莹"
}
],
"team_state": 2,
"score": 3.5,
"total_score": 75.1,
"kill": 3,
"rank": 4
},
{
"team_name": "西安体育学院",
"players": [
{
"player_name": "西体.不眠",
"player_state": 2,
"hero": "宁红夜"
},
{
"player_name": "西体.Reze",
"player_state": 2,
"hero": "无尘"
},
{
"player_name": "西体.北北",
"player_state": 2,
"hero": "玉玲珑"
}
],
"team_state": 2,
"score": 17.1,
"total_score": 55.5,
"kill": 12,
"rank": 7
},
{
"team_name": "南京邮电大学",
"players": [
{
"player_name": "南邮.咖飞",
"player_state": 2,
"hero": "胡桃"
},
{
"player_name": "南邮.再等",
"player_state": 2,
"hero": "迦南"
},
{
"player_name": "南邮.啵啵鱼",
"player_state": 2,
"hero": "季莹莹"
}
],
"team_state": 2,
"score": 5.0,
"total_score": 41.4,
"kill": 5,
"rank": 9
},
{
"team_name": "湖南软件大学",
"players": [
{
"player_name": "湖南软件.子芊",
"player_state": 2,
"hero": "胡桃"
},
{
"player_name": "湖南软件.啊傑",
"player_state": 2,
"hero": "迦南"
},
{
"player_name": "湖南软件.龙鰲",
"player_state": 2,
"hero": "季莹莹"
}
],
"team_state": 2,
"score": 15.4,
"total_score": 55.8,
"kill": 12,
"rank": 6
},
{
"team_name": "海口经济学院",
"players": [
{
"player_name": "海经院.原地寄",
"player_state": 2,
"hero": "胡桃"
},
{
"player_name": "海经院.欢快信",
"player_state": 2,
"hero": "特木尔"
},
{
"player_name": "海经院.亚风",
"player_state": 2,
"hero": "武田信忠"
}
],
"team_state": 2,
"score": 1.5,
"total_score": 59.4,
"kill": 1,
"rank": 5
},
{
"team_name": "东大成贤学院",
"players": [
{
"player_name": "东大成贤.CC",
"player_state": 2,
"hero": "胡桃"
},
{
"player_name": "东大成贤.小雨",
"player_state": 2,
"hero": "迦南"
},
{
"player_name": "东大成贤.为梦",
"player_state": 2,
"hero": "季莹莹"
}
],
"team_state": 2,
"score": 14.7,
"total_score": 41.3,
"kill": 11,
"rank": 10
},
{
"team_name": "西京学院",
"players": [
{
"player_name": "西京.木木",
"player_state": 2,
"hero": "宁红夜"
},
{
"player_name": "西京.狂言",
"player_state": 2,
"hero": "特木尔"
},
{
"player_name": "西京.卿九",
"player_state": 2,
"hero": "季莹莹"
}
],
"team_state": 2,
"score": 7.1,
"total_score": 44.4,
"kill": 6,
"rank": 8
},
{
"team_name": "重庆交通大学",
"players": [
{
"player_name": "重庆交大.哆点",
"player_state": 2,
"hero": "胡桃"
},
{
"player_name": "重庆交大.泡泡",
"player_state": 2,
"hero": "迦南"
},
{
"player_name": "重庆交大.zy",
"player_state": 2,
"hero": "季莹莹"
}
],
"team_state": 2,
"score": 2.0,
"total_score": 75.5,
"kill": 0,
"rank": 3
},
{
"team_name": "华北理工大学",
"players": [
{
"player_name": "华北理工.89ms",
"player_state": 2,
"hero": "胡桃"
},
{
"player_name": "华北理工.59ms",
"player_state": 2,
"hero": "天海"
},
{
"player_name": "华北理工.58ms",
"player_state": 2,
"hero": "岳山"
}
],
"team_state": 2,
"score": 0.0,
"total_score": 15.5,
"kill": 0,
"rank": 12
}
]
}
"""
    return jsonstr


# 首杀
# 追击任务
# 叫阵任务
# 宝库开启
# 购买地煞
# 使用地煞
# 获得返魂
# 使用返魂
# 回阳镜开启
# 进入回阳
# 回阳结算
# 回阳选择buff
roomidforevent = {}
HYJ_save = {}
#实时触发们
def CapRealtimeEvent():
    jsonstr = """
{
"data": {
"ZJ_TeamA": "-",
"ZJ_TeamB": "-",
"disha_buy_player_name": "",
"disha_buy_item_name": "地煞符·初级",
"disha_use_player_name": "",
"disha_use_item_name": "地煞符·初级",
"baoku_buy_player_name": "-",
"baoku_buy_item_name": "-",
"baoku_use_player_name": "-",
"baoku_use_item_name": "-",
"fanhun_buy_player_name": "-",
"fanhun_buy_item_name": "-",
"fanhun_use_player_name": "-",
"fanhun_use_item_name": "-",
"HYJ_in_1": 0,
"HYJ_teamA_1": "-",
"HYJ_teamB_1": "-",
"HYJ_win_1": 0,
"HYJ_win_team_1": "-",
"HYJ_in_2": 0,
"HYJ_teamA_2": "-",
"HYJ_teamB_2": "-",
"HYJ_win_2": 0,
"HYJ_win_team_2": "-",
"HYJ_in_3": 0,
"HYJ_teamA_3": "-",
"HYJ_teamB_3": "-",
"HYJ_win_3": 0,
"HYJ_win_team_3": "-",
"HYJ_in_4": 0,
"HYJ_teamA_4": "-",
"HYJ_teamB_4": "-",
"HYJ_win_4": 0,
"HYJ_win_team_4": "-",
"HYJ_in_5": 0,
"HYJ_teamA_5": "-",
"HYJ_teamB_5": "-",
"HYJ_win_5": 0,
"HYJ_win_team_5": "-"
}
}
"""
    return jsonstr

def CapMvp():
    jsonstr = """
{
"data": {
"team_name": "浙江交通职院",
"kill_times": 8,
"player_name": "浙江交通.小牛",
"damage": 20902.0,
"melee_damage": 12287.0,
"counterstrikes": 0,
"kill_in_reborn_period": 1,
"cure": 7559.0,
"assist_count": 6,
"rescue_times": 0,
"weapon1": "枪",
"weapon1_damage": "9191.0",
"weapon2": "技能奥义",
"weapon2_damage": "7758.0",
"weapon3": "双刀",
"weapon3_damage": "1304.0",
"skill1": "昆仑诀·禁疗",
"skill2": "赤练无明·无拘",
"soul1": "大魂玉·攻击",
"soul2": "大魂玉·攻击",
"soul3": "金刚指",
"soul4": "大魂玉·减伤",
"soul5": "万夫莫敌·重",
"soul6": "夺魂",
"hero": "宁红夜",
"max_damage": 22221.0,
"max_kill_times": 9,
"max_kill_in_reborn_period": 3,
"max_assist_count": 9,
"max_rescue_times": 2,
"max_cure": 21386.0,
"max_melee_damage": 18657.0,
"max_counterstrikes": 4
}
}
"""
    return jsonstr        


def thd2RefreshStage():
    while True:
        time.sleep(2)
        m.RefreshStages()

if __name__ == "__main__":
    #mt = threading.Thread(target=thd2RefreshStage)
    #mt.start()
    runapp()
    #mt.join()
    #CapHeroSelectTeam()


#他们要的13个接口

# 1 英雄选择3排
# 战队名
# 选手名*3
# 选择英雄*3
# 携带技能f*3
# 携带技能v*3
# 阵容选择率
# 场均得分
# 上局积分
# 地图名 -
# 天气 -

# 2 英雄选择单排
# 战队名
# 选手名
# 选择英雄
# 携带技能f
# 携带技能v
# 英雄选择率
# 场均得分
# 上局积分
# 地图名 -
# 天气 -

# 3 跳点展示
# 战队/选手跳点坐标

# 4 单局积分
# 排名
# 战队名/选手名
# 击杀数
# 击败分
# 排名分
# 单局总分

# 5 总积分
# 排名
# 战队名/选手名
# 第123456场积分
# 第123456场吃鸡判定
# 总积分

# 6 赛后战队数据
# 排名
# 战队名称
# 选手名*3
# 本局英雄*3
# F*3
# V*3
# 击败数*3
# 治疗量*3
# 伤害*3
# 助攻数*3
# 存活时间*3
# 救援次数*3

# 7 mvp三排
# 战队名
# 选手名
# 击败树
# 伤害量
# 治疗量
# 返魂期击杀
# 助攻
# 战神数
# 伤害最高武器and伤害1
# 伤害最高武器and伤害2
# 伤害最高武器and伤害3
# 使用魂玉*6
# 使用英雄
# F
# V

# 8 mvp单排
# 选手名
# 击败树
# 伤害量
# 治疗量
# 近战伤害
# 振捣数
# 战神数
# 伤害最高武器and伤害1
# 伤害最高武器and伤害2
# 伤害最高武器and伤害3
# 使用魂玉*6
# 使用英雄
# F
# V

# 9 三排击杀榜
# 战队名*10
# 选手名*10
# 排名*10
# 总击杀10
# 总伤害10

# 10 单排击杀
# 选手名*10
# 排名*10
# 总击杀10
# 总伤害10

# 11 场均得分
# 战队名/选手名 *16
# 场均得分*16

# 12 实时生存 三排
# 战队名
# 英雄名*3
# 存活状态 正常返魂死亡
# 全队状态  在不在
# 总击败
# 当前总分

# 13 单排的实时生存
# 选手名
# 英雄名
# 存活状态
# 总击败
# 当前总分

# 14 触发事件
# 首杀
# 追击任务
# 叫阵任务
# 宝库开启
# 购买地煞
# 使用地煞
# 获得返魂
# 使用返魂
# 回阳镜开启
# 进入回阳
# 回阳结算
# 回阳选择buff

# 15 每局赛果
# 吃鸡队伍名 选手名 *6
# 本局得分
# 地图名 -
# 天气 -